const Koa = require('koa');
// const request = require("request");
const app = new Koa();
const port = 3000

var cors = require('koa-cors');
app.use(cors());
const static = require('koa-static');
app.use(static(__dirname + '/static'));
const koaBody = require('koa-body');
const yd_router = require("./yd_router")

app.use(koaBody({
    multipart: true,
    formidable: {
        maxFileSize: 1024 * 1024 * 200
    }
}));

app
   .use(yd_router.router.routes())
   .use(yd_router.router.allowedMethods());

// response
// app.use(ctx => {
//   ctx.body = 'Hello Koa';
// });

console.log("服务器运行成功" + port)
app.listen(port);